package org.example.entity;
import java.sql.Timestamp;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.example.entity.UserAuthenticationDO;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;

/**
 * <p>
 *   用户会话信息实体类
 * </p>
 * @author jinshihui
 */
@Entity
@Table(name = "user_session")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserSessionDO {
    @Id
    private String sessionId;

    @ManyToOne
    @JoinColumn(name = "user_id", nullable = false)
    private UserAuthenticationDO user;

    @Column(nullable = false)
    private Timestamp loginTime;

    private Timestamp logoutTime;

    private String ipAddress;

    private String userAgent;

    private String createBy;

    @Column(updatable = false)
    private Timestamp createTime;

    private String updateBy;

    @UpdateTimestamp
    private Timestamp updateTime;
}